Component({
    data: {
        height: 0
    },

    lifetimes: {
        ready() {
            // 获取到胶囊距离顶部的距离设置给 height
            const rect = wx.getMenuButtonBoundingClientRect()
            this.setData({
                height: rect.top
            })
        }
    }
})